package huoye.shops.huoye.operation.activity;

import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;

import butterknife.BindView;
import butterknife.OnClick;
import huoye.shops.R;
import huoye.shops.base.BaseActivity;
import huoye.shops.huoye.operation.model.ObtainShopType;
import huoye.shops.huoye.operation.presenter.BangBoBlackCardPresenter;
import huoye.shops.huoye.operation.view.IBangBoBlackCardView;
import huoye.shops.huoye.operation.widget.DiscountSelectDialog;

public class AddAllinceActivity extends BaseActivity implements IBangBoBlackCardView{


    String discount = "";
    @BindView(R.id.add_allince_tv_select)
    TextView tvSelect;
    private BangBoBlackCardPresenter mBangBoBlackCardPresenter;

    @OnClick(R.id.add_allince_ll_select)
    void onSelectClick(){
        showDialog();
    }

    @OnClick(R.id.add_allince_btn_affirm_add)
    void onAffirmAddClick(){
        mBangBoBlackCardPresenter.JoinShopCardType("1",discount);
    }

    @Override
    protected int getContentViewId() {
        return R.layout.activity_add_allince;
    }

    @Override
    protected void initView(@Nullable Bundle bundle) {
        setTitle("加入联盟");
        mBangBoBlackCardPresenter = new BangBoBlackCardPresenter();
        mBangBoBlackCardPresenter.addTaskListener(this);
        mBangBoBlackCardPresenter.onStart();
    }



    private void showDialog(){
        DiscountSelectDialog discountSelectDialog = new DiscountSelectDialog(this);
        discountSelectDialog.setOnDiscountSelectListener(new DiscountSelectDialog.OnDiscountSelectListener() {
            @Override
            public void onDiscountSelectClick(int i) {
                tvSelect.setText((i+1)+"折");
                discount = (i+1)+"";
            }
        });
        discountSelectDialog.show();
    }

    @Override
    public void getShopType() {

    }
}
